#pragma region  【算法5 - 10】Kruskal 方法构造无向网的最小生成树
void Kruskal(EdgeType edges[], EdgeType T[])
{ //用Kruskal方法构造图的最小生成树
    // edge中是图中各条边，且已按其权值从小到大有序
    //最小生成树的边在T中
    int father[N];
    int i, j, vf1, vf2;
    for (i = 0; i < N; i++)
        father[i] = -1;
    i = 0;
    j = 0;
    while (i < E && j < N - 1)
    {
        vf1 = Find(father, edges[i].v1);
        vf2 = Find(father, edges[i].v2);
        if (vf1 != vf2)
        {
            father[vf2] = vf1;
            T[j] = edges[i];
            j++;
        }
        i++;
    }
}
int Find(int father[], int v)
{ //寻找顶点v所在树的根结点
    int t;
    t = v;
    while (father[t] >= 0)
        t = father[t];
    return (t);
}
#pragma endregion